import $ from "jquery";

/* eslint-disable */
$.fn.extend({
  item1ProgressBarWars: function (a) {
    var b = this;
    var e = $(b).attr("id");
    var d = Date.now();
    var c = "";
    const defaults = {
      porcentaje: "100",
      tiempo: 1000,
      color: "",
      estilo: "yoda",
      tamanio: "30%",
      alto: "6px",
    };
    var a = $.extend({}, defaults, a);
    if (a.color != "") {
      c =
        "<style>.color" +
        d +
        "{ border-radius: 6px;display: block; width: 0%; box-shadow:0px 0px 10px 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ", 0 0 1px " +
        a.color +
        ";background-color: #fff;}</style>";
      a.estilo = "color" + d;
    }
    $(b).before(c);
    if (a.flag) {
      $(b).append(
        '<span class="barControl" style="width:' +
          a.tamanio +
          ';"><div class="barContro_space"><span class="' +
          a.estilo +
          '" style="height: ' +
          a.alto +
          ';"  id="bar' +
          e +
          '"></span></div></span>'
      );
    }
    $("#bar" + e).animate(
      {
        width: a.porcentaje + "%",
      },
      a.tiempo
    );
    this.mover = function (f) {
      $("#bar" + $(this).attr("id")).animate(
        {
          width: f + "%",
        },
        a.tiempo
      );
    };
    return this;
  },
});
